package com.wushi.lenovo.asia5b.app_widget

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.wushi.lenovo.asia5b.R
import kotlinx.android.synthetic.main.view_logistics2.view.*

/**
 * Created by zhangyuncai on 2019/7/10.
 * 物流进度条
 */
class LogisticsView2 @JvmOverloads constructor(
        context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
    init {
        View.inflate(context, R.layout.view_logistics2, this)
    }

    /**
     * 设置物流状态
     * @param status 值得范围是0-4
     */
    fun setDeliveredStatus(status: Int) {
        iv_logistics_circle1.isSelected = status > 0
        iv_logistics_circle2.isSelected = status > 1
        iv_logistics_circle3.isSelected = status > 2
        iv_logistics_circle4.isSelected = status > 3
        view_logistics_line1.isSelected = status > 1
        view_logistics_line2.isSelected = status > 2
        view_logistics_line3.isSelected = status > 3
        when (status) {
            0 -> {//无任何物流信息

            }
            1 -> {//出库

            }
            2 -> {//到达海关

            }
            3 -> {//派发

            }
            4 -> {//完成

            }
        }
    }
}